using System;
using dbm2.Model.Types;

namespace dbm2.Model
{
    public class Field
    {
        private Table parentTable;

        public FieldConstraints Constraint;
        public DBMType Type { get; set; }
        public string Name { get; private set; }

        public Field(string name)
        {
            Name = name;
            parentTable = null;
            Constraint = new FieldConstraints();
        }

        public Table GetParentTable()
        {
            return parentTable;
        }

        public void SetTable(Table table)
        {
            if(table.IsContainsField(this))
                parentTable = table;
        }
    }
}